AIS Software

AIS Dispatcher

Send AIS messages to multiple IP addresses AIS Dispatcher

AISdeco2

Summary

AIS reception for OpenCPN using an inexpensive Software Defined Radio (SDR) and a freeware decoder. Live reception and decoding from VHF channels 87B and 88B.

This is a walk-though installation for Windows 10 users. This could be adapted to work with Linux (Intel/AMD and RapsberryPi).

These instructions are dependent on other websites and software; they were correct when the wiki was written but are subject to change.

Hardware

SDR Dongles based on the Realtek RTL2832U are numerous. I have tested three devices on a laptop running Windows 10 64-bit.

These devices have a USB type A plug that can be directly plugged into a USB A socket. But in my opinion, the devices are a bit too heavy and bulky for direct connection and a short USB extension cable is a sensible option.

The antenna will be used for receiving only and need not be expensive. However, a good quality VHF antenna and cable, suitably sited, will ensure good reception.

Windows 10 installation

I am assuming OpenCPN is already installed on the target PC and that you are within reception range of AIS transmissions.

SDRsharp and the hardware driver

SDRsharp is freeware. It isn’t required for normal operation but is very helpful when installing the SDR dongle and in getting it to work.

Point your internet browser at this website: https://airspy.com/download

Download and install .NET 5 runtime x86 This link redirects to Microsoft

Return to https://airspy.com/download

Download and install Community Package with Plugins. You may need to jump through some hoops before your browser and defender allows you to do this.

Plug-in the SDR device. Device manager is likely to show Bulk-in interfaces with no driver.

Windows Start menu→SDRsharp→Zadig

Bulk-in Interface 0. Install driver WinUSB. It will take up to five minutes and Zadig may appear to freeze during that time.

Repeat for Bulk-in Interface 1 then device manager should look like this.

Close Zadig.

Windows Start menu→SDRsharp→SDRsharp

Select RTL-SDR USB

Click the gear icon

Set gain ½ way.

Close the setting window.

Press Play (Triangle icon), set to a marine VHF frequency.

Marine VHF is narrow band (NFM) Ch16 is on 156.8MHz.

The AIS channels are 87B and 88B (161.975MHz and 162.025MHz).

Other marine VHF frequencies are here: https://en.wikipedia.org/wiki/Marine_VHF_radio

Adjust the RF Gain and Frequency correction (ppm) to obtain an image similar to that shown below.

Make a note of the gain and ppm values.

Close SDRsharp.

Assuming there are no further problems, SDRsharp and Zadig will not be required again. But if you have room on your hard drive I’d keep them; there are a lot of other things you can do with a SDR dongle and SDRsharp should you wish to experiment.

AISDECO2

AISDECO2 is a free application. It uses the SDR dongle to receive AIS packets, decode them and sends them out as NMEA sentences on a UDP port.

Create a folder;

Point your internet browser at this website: http://xdeco.org/

Download AiSDeco2 for Windows

Unzip in the newly created folder. IE C:\Program Files\aisdeco2 or C:\Program Files (x86)\aisdeco2

Delete the zip file.

Batch file launcher

Download the launcher batch file from here (or copy from appendix 1 below);

AIS Batch File Launcher

Save or rename it with a *.BAT extension.

Save in C:\Program Files\aisdeco2 or C:\Program Files (x86)\aisdeco2

Open the batch file for editing.

Use Notepad or Notepad++. Do not use a word-processor.

  1. Enter the gain figure you noted from SDRsharp.
  2. Enter the frequency correction figure you noted from SDRsharp (use 1 if no correction is needed because 0 will cause an error).
  3. Make a note of the aisdeco2_udp_port value (4159 at the time of writing).
  4. Review the other REM statements and make changes relevant to your system.
  5. Save your changes.

Create a shortcut for the batch file, save the shortcut on the desktop.

OpenCPN set-up

AISDECO2 exports !AIVDM messages on a UDP port. You must configure a matching OpenCPN connection as shown below. The DataPort should match the value you used in the batch file.

Close OpenCPN.

Launch OpenCPN with AIS

Ensure the SDR is plugged in and the antenna is connected. Run the batch file by double clicking the shortcut you saved to the desktop.

  1. A console window will launch.
  2. If timeout is configured you will see a countdown.
  3. A second console window will launch. You will see some initial parameters and then !AIVDM messages as they are received. This window will remain open.
  4. OpenCPN should launch; the batch file assumes the “normal” folder is used for installation.
  5. The first console window should close.

If there are AIS messages you should see something similar to the screen capture below. The AISDECO2 window can simply be minimised or moved behind OpenCPN. The AISDECO2 must remain open, but no interaction with it is required.

Launch when Windows boots

To automatically launch OpenCPN with AIS when windows starts;

Copy or move the batch file shortcut to;

C:\Users\xxxxx\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Where xxxxx is the Windows user account name you use for OpenCPN.

Appendix 1. Batch file contents

AIS Batch File Launcher

REM --------------------- Beginning of File -----------------------------------

REM Windows 10 launcher for OpenCPN with AISDECO2

REM John Cameron 18 Sep 2021

REM Delay (in seconds) before launch. Sometimes useful if the batch file is run at PC startup.
timeout 5

REM SDR dongle parameters - set as required.

REM Device index set to 0 if only one SDR dongle is present on the system, otherwise use aisdeco2 --device_index to determine which dongle to use for AIS.

REM This is significant, for example, if you use a second SDR for HF reception on the same PC.
set aisdeco2_device_index=0

REM Receiver gain in db. Use the free application AIRSPY to determine a good value.
set aisdeco2_gain=40.2

REM Frequency correction in ppm. Use the free application AIRSPY to determine a good value. NB 0 will cause an error.
set aisdeco2_freq_correction=1

REM Set the UDP address and port. You must also set an OpenCPN "connection" to match this.  
set aisdeco2_udp_address=localhost
set aisdeco2_udp_port=4159

REM End of SDR dongle parameter settings.

REM OpenCPN command line arguments - add as required (eg /fullscreen).
REM set opencpn_arg=/fullscreen
REM End of OpenCPN command line arguments.

REM Construct AISDECO2 arguments string.
set aisdeco2_arg=--device-index %aisdeco2_device_index% --gain %aisdeco2_gain% --freq-correction %aisdeco2_freq_correction% --udp %aisdeco2_udp_address%:%aisdeco2_udp_port%

REM Expect AISDECO2 to be in a subfolder of ProgramFiles or ProgramFiles (x86).
set aisdeco2_path="%ProgramFiles%\aisdeco2\aisdeco2.exe" %aisdeco2_arg%
if exist "%ProgramFiles(x86)%\aisdeco2" set aisdeco2_path="%ProgramFiles(x86)%\aisdeco2\aisdeco2.exe" %aisdeco2_arg%

REM Launch AISDECO2 - the console window will remain open.

REM To quit AISDECO2, either type Ctrl-C in the console, or close the console window.
start "AISDECO2" %aisdeco2_path%

REM Expect OpenCPN to be in a subfolder of ProgramFiles or ProgramFiles (x86).
set opencpn_path="%ProgramFiles%\opencpn\opencpn.exe" %opencpn_arg%
if exist "%ProgramFiles(x86)%\opencpn" set opencpn_path="%ProgramFiles(x86)%\opencpn\opencpn.exe" %opencpn_arg%

REM Launch OpenCPN - The console window will close
start "Launch OpenCPN" %opencpn_path%

REM --------------------- End of File -----------------------------------

Acknowledgments

AISDECO2

Freeware courtesy of xDeco.org

Jeremy Clark for this helpful video https://www.youtube.com/watch?v=Ik7XJkeZrW4

SDRsharp

Freeware courtesy of airspy.com

Community Package with Plugins maintained by Rodrigo Pérez.

.NET 5 Desktop x86 Runtime courtesy of Microsoft Corp.

Zadig

Freeware courtesy of https://zadig.akeo.ie/